using System;
using System.Collections.Generic;
using System.Text;

namespace TextEditor
{
    public class A_TableLock : A_Action
    {
        public override string ActionName()
        {
            return "tableLocked";// "tableLocked";
        }

        public override int CheckState()
        {
            ZYTextTable table = base.myOwnerDocument.GetInTable(base.myOwnerDocument.Content.CurrentElement);
            if (table != null)
                return table.TableLock ? 1 : 0;
            return 0;
        }

        public override bool isEnable()
        {
            return base.myOwnerDocument.GetInTable(base.myOwnerDocument.Content.CurrentElement) == null ? false : true;
        }

        public override bool UIExecute()
        {
           ZYTextTable table = base.myOwnerDocument.GetInTable(base.myOwnerDocument.Content.CurrentElement);
           if (table != null)
           {
               table.TableLock = !table.TableLock;
           }
            return true;
        }
    }
}
